/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ghanaroutes.webservices;

import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author User
 */
@WebService(serviceName = "ghanaroutes")
@Stateless()
public class ghanaroutes {

    @EJB
    private ghanaroutesBeanLocal ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "createUser")
    public String createUser(@WebParam(name = "username") String username, @WebParam(name = "phoneNo") String phoneNo) {
        return ejbRef.createUser(username, phoneNo);
    }

    @WebMethod(operationName = "saveRoute")
    public String saveRoute(@WebParam(name = "user_id") int user_id, @WebParam(name = "from") String from, @WebParam(name = "to") String to, @WebParam(name = "lat") String lat, @WebParam(name = "parameter1") String parameter1, @WebParam(name = "duration") String duration, @WebParam(name = "distance") String distance, @WebParam(name = "mode") String mode, @WebParam(name = "description") String description, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.saveRoute(user_id, from, to, lat, parameter1, duration, distance, mode, description, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "getUserSavedRoutes")
    public String getUserSavedRoutes(@WebParam(name = "userId") String userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.getUserSavedRoutes(userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "getRouteByRouteId")
    public String getRouteByRouteId(@WebParam(name = "routeId") String routeId, @WebParam(name = "userId") String userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.getRouteByRouteId(routeId, userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "searchPopularPlaces")
    public String searchPopularPlaces(@WebParam(name = "userId") String userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.searchPopularPlaces(userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "searchPopularPlacesLocations")
    public String searchPopularPlacesLocations(@WebParam(name = "placeId") String placeId, @WebParam(name = "userId") String userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.searchPopularPlacesLocations(placeId, userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "getPopularLocationRoutes")
    public String getPopularLocationRoutes(@WebParam(name = "routeId") String routeId, @WebParam(name = "userId") String userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.getPopularLocationRoutes(routeId, userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "searchRoutes")
    public String searchRoutes(@WebParam(name = "from") String from, @WebParam(name = "to") String to, @WebParam(name = "userId") String userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.searchRoutes(from, to, userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "getPopularLocationRoute")
    public String getPopularLocationRoute(@WebParam(name = "routeId") String routeId, @WebParam(name = "userId") String userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.getPopularLocationRoute(routeId, userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "addPopularLoc")
    public String addPopularLoc(@WebParam(name = "placeId") int placeId, @WebParam(name = "locationName") String locationName, @WebParam(name = "description") String description, @WebParam(name = "address") String address, @WebParam(name = "userId") int userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.addPopularLoc(placeId, locationName, description, address, userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "addPopularLocRoute")
    public String addPopularLocRoute(@WebParam(name = "locationId") int locationId, @WebParam(name = "fromLoc") String fromLoc, @WebParam(name = "pathLong") String pathLong, @WebParam(name = "pathLat") String pathLat, @WebParam(name = "userId") int userId, @WebParam(name = "description") String description, @WebParam(name = "distance") String distance, @WebParam(name = "duration") String duration, @WebParam(name = "mode") String mode, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.addPopularLocRoute(locationId, fromLoc, pathLong, pathLat, userId, description, distance, duration, mode, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "setInvisible")
    public String setInvisible(@WebParam(name = "userId") int userId, @WebParam(name = "visible") byte visible, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.setInvisible(userId, visible, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "findFriend")
    public String findFriend(@WebParam(name = "userId") int userId, @WebParam(name = "phoneNo") String phoneNo, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.findFriend(userId, phoneNo, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "whoViewedMe")
    public String whoViewedMe(@WebParam(name = "userId") int userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.whoViewedMe(userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "blockFriends")
    public String blockFriends(@WebParam(name = "userId") int userId, @WebParam(name = "friends") String friends, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.blockFriends(userId, friends, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "unblockFriend")
    public String unblockFriend(@WebParam(name = "userId") int userId, @WebParam(name = "friend") int friend, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.unblockFriend(userId, friend, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "viewedBlockedFriends")
    public String viewedBlockedFriends(@WebParam(name = "userId") int userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.viewedBlockedFriends(userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "addRouteComment")
    public String addRouteComment(@WebParam(name = "userId") int userId, @WebParam(name = "routeId") int routeId, @WebParam(name = "routeType") int routeType, @WebParam(name = "comment") String comment, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.addRouteComment(userId, routeId, routeType, comment, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "addNotification")
    public String addNotification(@WebParam(name = "userId") int userId, @WebParam(name = "notificationType") byte notificationType, @WebParam(name = "routeOrAlertId") int routeOrAlertId, @WebParam(name = "generatedFor") String generatedFor, @WebParam(name = "details") String details, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.addNotification(userId, notificationType, routeOrAlertId, generatedFor, details, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "getNotifications")
    public String getNotifications(@WebParam(name = "userId") int userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.getNotifications(userId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "delNotification")
    public String delNotification(@WebParam(name = "userId") int userId, @WebParam(name = "notificationId") int notificationId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.delNotification(userId, notificationId, loc, curLoc, curCity);
    }

    @WebMethod(operationName = "clearNotifications")
    public String clearNotifications(@WebParam(name = "userId") int userId, @WebParam(name = "loc") String loc, @WebParam(name = "curLoc") String curLoc, @WebParam(name = "curCity") String curCity) {
        return ejbRef.clearNotifications(userId, loc, curLoc, curCity);
    }
    
    
    @WebMethod(operationName = "sendAlert")
    public String sendAlert(@WebParam(name = "location")String location, @WebParam(name="areaName")String areaName,@WebParam(name ="cause") String cause, @WebParam(name="dateInput")String dateInput, @WebParam(name="user_id") String user_id)
    {
        return ejbRef.sendAlert(location, areaName, cause, dateInput,user_id);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "viewAreaAlerts")
    public String viewAreaAlerts(@WebParam(name = "currentLocation") String currentLocation, @WebParam(name = "areaName") String areaName) {
        //TODO write your implementation code here:
        return ejbRef.viewAreaAlerts(currentLocation, areaName);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "addComment")
    public String addComment(@WebParam(name = "comment") String comment, @WebParam(name = "user_id") String user_id, @WebParam(name = "group_id") String group_id) {
        //TODO write your implementation code here:
        return ejbRef.addComment(user_id, group_id, comment);
    }

    
}
